import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import ElementUI, { MessageBox, Message } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import axios from 'axios'
Vue.use(ElementUI)

Vue.prototype.$axios = axios
Vue.prototype.$msgbox = MessageBox
Vue.prototype.$message = Message
Vue.prototype.$basicIndex = {
  learn: 0,
  experience: 0,
  health: 0,
  burnout: 0,
  // anxious: 0,
  pressure: 0,
  ability: 0,
  // ba: 0,
  pa: 0,
  ea: 0,
  sa: 0,
  pb: 0,
  influence: 0,
  oi: 0,
  pi: 0,
  si: 0
}

Vue.prototype.$avgIndex = {
  learn: 0,
  experience: 0,
  health: 0,
  burnout: 0,
  // anxious: 0,
  pressure: 0,
  ability: 0,
  // ba: 0,
  pa: 0,
  ea: 0,
  sa: 0,
  pb: 0,
  influence: 0,
  oi: 0,
  pi: 0,
  si: 0
}

Vue.prototype.$stdIndex = {
  learn: 0,
  experience: 0,
  health: 0,
  burnout: 0,
  // anxious: 0,
  pressure: 0,
  ability: 0,
  // ba: 0,
  pa: 0,
  ea: 0,
  sa: 0,
  pb: 0,
  influence: 0,
  oi: 0,
  pi: 0,
  si: 0
}
const savedState = JSON.parse(sessionStorage.getItem('vuex_state'))
if (savedState) {
  store.replaceState(savedState)
}

// 在每次 mutation 发生时保存状态到本地存储中
store.subscribe((mutation, state) => {
  sessionStorage.setItem('vuex_state', JSON.stringify(state))
})

Vue.config.productionTip = false

// new Vue({
//   router,
//   store,
//   render: h => h(App)
// }).$mount('#app')
/* eslint-disable no-new */
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
